package actions;

import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import donnees.*;

import metier.IMetier;

public class ActionVoirPageCommandeValid extends UnicastRemoteObject implements IAction{
	private static final long serialVersionUID = -8106351444735646355L;

	public ActionVoirPageCommandeValid() throws RemoteException {
		super();
	}

	@Override
	public String execute(HttpServletRequest req) throws Exception {
		HttpSession theSession=req.getSession(true);
		IMetier metier=(IMetier)Naming.lookup("rmi://localhost:2000/ServeurMetier");
		metier.enregistrerCommande((Client)theSession.getAttribute("leClient"),(Panier)theSession.getAttribute("Panier"));
		theSession.setAttribute("Panier", null);
		return "pageCmdeValid.jsp";
	}

}
